﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CustomExceptionHandling
{
    class Program
    {
        static void Main(string[] args)
        {
            CoffeeMachineTest();
            try
            {
                TextProcess(null);
            }
            catch (ArgumentNullException ex)
            {
                Console.WriteLine(ex.ParamName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }

        private static void CoffeeMachineTest()
        {
            CoffeeMachine cm=new CoffeeMachine();
            cm.Setup(200, 70);

            try
            {
                cm.GetCupOfCoffee();
                cm.GetCupOfCoffee();
                cm.GetCupOfCoffee();
                cm.GetCupOfCoffee();
                cm.GetCupOfCoffee();
                cm.GetCupOfCoffee();
            }
            catch (NotEnoughIngredientException ex)
            {

                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.MissingIngredient); 
            }
            
        }

        static void TextProcess(string s)
        {

            //string res = s.Trim();
            //try
            //{
            //    string res = s.Trim();
            //}
            //catch(Exception e)
            //{

            //}
            if (s == null)
            {
                throw new ArgumentNullException("s");
            }

        }
    }

}
